package com.temp.enumeration;

import lombok.Getter;

@Getter
public enum PayStatus {
    WAITING_PAY(0, "等待支付"),
    PAID_SUCCESS(1, "支付成功");

    private final Integer code;
    private final String desc;

    PayStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static PayStatus fromCode(int code) {
        for (PayStatus status : PayStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        return null;
    }
}
